<?php

namespace App\model\panyuan;

use App\User;
use App\model\UserRole;
use Illuminate\Database\Eloquent\Model;

/**
 * App\model\panyuan\UserShenheLog
 *
 * @property int $id
 * @property int|null $shenhe_id 审核内容的id
 * @property int|null $user_id 审核人
 * @property int|null $status 0 审核通过 1 拒绝
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property string|null $reject_reason 拒绝原因
 * @property string|null $title
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereRejectReason($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereShenheId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereUserId($value)
 * @mixin \Eloquent
 * @property string|null $code 审核code
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereCode($value)
 * @property-read \App\model\User|null $user
 * @property int|null $role_id
 * @method static \Illuminate\Database\Eloquent\Builder|\App\model\panyuan\UserShenheLog whereRoleId($value)
 * @property-read \App\model\UserRole|null $role
 */
class UserShenheLog extends Model
{
    protected $table="user_shenhe_log";
    const STATUS_PASS=0;
    const STATUS_REJECT=1;
    const STATUS_CANCEL=2;
    static  public $statusMap=[
        self::STATUS_REJECT=>'已驳回',
        self::STATUS_PASS=>'已通过',
        self::STATUS_CANCEL=>'取消申请'
    ];
    public function user(){
        return $this->belongsTo(User::class,'user_id');
    }
    public function role(){
        return $this->belongsTo(UserRole::class,'role_id');
    }
}
